<?php 
include '../Connections/KRAPPERCON.php';
include('../Connections/Accesos.php');
?>

<form method="get" id="frm_regven" target="_blank" >
<div>
<input type="button" value="Exportar" onclick="regVentasXls();" />
<input type="hidden" value="export" name="oper" id="oper"/>
<input type="radio" name="rv_opt" id="rv_xls" checked="checked" value="rv_xls" />
&nbsp;Formato Excel&nbsp;&nbsp;
<input type="radio" name="rv_opt" id="rv_pdf" value="rv_pdf" />
&nbsp;Formato PDF
</div>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

  <tr class="noView">
    <td>Fecha Factura:</td>
    <td colspan="3">
      <input name="t_rv_fini" value="<?php echo $hoy;?>" class="tcal" type="text" id="t_rv_fini" size="15" maxlength="10" />
&nbsp;
    a 
    &nbsp;
    <input name="t_rv_ffin" value="<?php echo $ultDia;?>" class="tcal" type="text" id="t_rv_ffin" size="15" maxlength="10" />
  </td>
  </tr>
   <tr>
    <td>Periodo :</td>
    <td colspan="3"><select name="cb_per_rv" id="cb_per_rv">
    <?php 
	include ("../Query_Min/getPeriodos.php");
	?>
    </select>
    </td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</form>
<script type="text/javascript">
function regVentasXls(){
	if (GEBI('rv_xls').checked){
	GEBI('frm_regven').action = "Consultas/Opers/queryRegVen.php";
	GEBI('oper').value = 'export';
	}
	if (GEBI('rv_pdf').checked){
	GEBI('frm_regven').action = "Consultas/Opers/queryRegVenPDF.php";
	GEBI('oper').value = 'pdf';
	}
//	alert(GEBI('oper'));
	var per = GEBI('cb_per_rv').value;
	var ann = per.substring(0,4);
	var mes = per.substring(5);
	if (pInt(mes)<10){
	mes = '0'+mes;
	}
	GEBI('t_rv_fini').value = ann+"-"+mes+"-01";
	GEBI('t_rv_ffin').value = ann+"-"+mes+"-"+(daysInMonth(mes,ann));	
	//	var fini = GEBI('t_rc_fini').value;
//	var ffin = GEBI('t_rc_ffin').value;
	GEBI('frm_regven').submit();
	}
</script>
